package com.fanhang.samples.spring.mvc.advice;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.stereotype.Component;

@Component
@Aspect
public class BeforeAdviceTest {

	public BeforeAdviceTest() {

		System.out.println("AOP->BeforeAdviceTest");
	}

	@Around("execution(* com.fanhang.samples.spring.mvc.controller..*.*(..))")
	public Object testAop(ProceedingJoinPoint pjp) throws Throwable {
		try {
			System.out.println("哈哈...");
			Object retVal = pjp.proceed();
			System.out.println(retVal);
			return retVal;
		} catch (Exception e) {
			System.out.println("异常");
			return null;
		}
	}
}
